import Vue from 'vue';
import VueRouter from 'vue-router';

Vue.use(VueRouter);

let prefix = window.__POWERED_BY_QIANKUN__ ? `/zhny/em` : '';
const routes = [
  // 站点维护-首页概览
  {
    path: `${prefix}/overview`,
    name: 'idxOverview',
    component: () => import('@/views/orgMgmt/Overview.vue'),
  },
  //站点维护-监测项目
  {
    path: `${prefix}/MonitorProj`,
    name: 'MonitorProj',
    component: () => import('@/views/zdwh/MonitorProj.vue'),
  },
  //站点维护-机构管理
  {
    path: `${prefix}/InsManage`,
    name: 'InsManage',
    component: () => import('@/views/zdwh/InsManage.vue'),
  },
  //站点维护-托管项目
  {
    path: `${prefix}/trusteeshipProject`,
    name: 'trusteeshipProject',
    component: () => import('@/views/zdwh/TrusteeshipProj.vue'),
  },
  // 监测机构能耗报表
  {
    path: `${prefix}/jcIns`,
    name: 'jcIns',
    component: () => import('@/views/ecStatistics/JCIns.vue'),
  },
  // 托管机构能耗报表
  {
    path: `${prefix}/tgIns`,
    name: 'tgIns',
    component: () => import('@/views/ecStatistics/TGIns.vue'),
  },

  {
    path: `${prefix}/carbonStas`,
    name: 'carbon',
    component: () => import('@/views/carbon/CarbonStas.vue'),
  },
  {
    path: `${prefix}/carbonMgt`,
    name: 'carbon',
    component: () => import('@/views/carbon/CarbonMgt.vue'),
  },

  // //监测机构报表-电
  // {
  //   path: `${prefix}/monitorEle`,
  //   name: 'monitorEle',
  //   component: () => import('@/views/monitor/MonitorEle.vue'),
  // },
  // //监测机构报表-水
  // {
  //   path: `${prefix}/monitorWater`,
  //   name: 'monitorWater',
  //   component: () => import('@/views/monitor/MonitorWater.vue'),
  // },
  // //监测机构报表-气
  // {
  //   path: `${prefix}/monitorAir`,
  //   name: 'monitorAir',
  //   component: () => import('@/views/monitor/MonitorAir.vue'),
  // },
  // //监测机构报表-暖
  // {
  //   path: `${prefix}/monitorWarm`,
  //   name: 'monitorWarm',
  //   component: () => import('@/views/monitor/MonitorWarm.vue'),
  // },
  // //监测机构报表-设备能耗
  // {
  //   path: `${prefix}/deviceEC`,
  //   name: 'deviceEC',
  //   component: () => import('@/views/monitor/DeviceEC.vue'),
  // },
  // //托管机构报表-电
  // {
  //   path: `${prefix}/trusteeshipEle`,
  //   name: 'trusteeshipEle',
  //   component: () => import('@/views/trusteeship/TrusteeshipEle.vue'),
  // },
  // //托管机构报表-水
  // {
  //   path: `${prefix}/trusteeshipWater`,
  //   name: 'trusteeshipWater',
  //   component: () => import('@/views/trusteeship/TrusteeshipWater.vue'),
  // },
  // //托管机构报表-气
  // {
  //   path: `${prefix}/trusteeshipAir`,
  //   name: 'trusteeshipAir',
  //   component: () => import('@/views/trusteeship/TrusteeshipAir.vue'),
  // },
  // //托管机构报表-暖
  // {
  //   path: `${prefix}/trusteeshipWarm`,
  //   name: 'trusteeshipWarm',
  //   component: () => import('@/views/trusteeship/TrusteeshipWarm.vue'),
  // },
  // 能效管理-能效诊断
  {
    path: `${prefix}/engDiagnosis`,
    name: 'engDiagnosis',
    component: () => import('@/views/engMgmt/EngDiagnosis.vue'),
  },
  // 能效管理-能源流向
  {
    path: `${prefix}/engFlow`,
    name: 'engFlow',
    component: () => import('@/views/engMgmt/EngFlowDirection.vue'),
  },
  // 能效管理-能耗趋势
  {
    path: `${prefix}/engTrend`,
    name: 'engTrend',
    component: () => import('@/views/engMgmt/EngTrend.vue'),
  },
  // 告警管理-日历
  {
    path: `${prefix}/alarmCalendar`,
    name: 'AlarmCalendar',
    component: () => import('@/views/alarmMgmt/AlarmCalendar.vue'),
  },
  // 告警管理-统计
  {
    path: `${prefix}/alarmStatistics`,
    name: 'alarmStatistics',
    component: () => import('@/views/alarmMgmt/AlarmStatistics.vue'),
  },
  // 数据记录-表记能耗
  {
    path: `${prefix}/gaugesImport`,
    name: 'gaugesImport',
    component: () => import('@/views/dataRecord/GaugesImport.vue'),
  },
  // 数据记录-区域能耗
  {
    path: `${prefix}/areaEngConsumption`,
    name: 'areaEngConsumption',
    component: () => import('@/views/dataRecord/AreaEngConsumption.vue'),
  },
  // 数据记录-设备系统能耗
  {
    path: `${prefix}/DSEngConsumption`,
    name: 'DSEngConsumption',
    component: () => import('@/views/dataRecord/DSEngConsumption.vue'),
  },
  // 数据记录-能源价格维护
  {
    path: `${prefix}/ePriceMaintenance`,
    name: 'ePriceMaintenance',
    component: () => import('@/views/dataRecord/EPriceMaintenance.vue'),
  },
  //风险库
  {
    path: `${prefix}/riskInfoLib`,
    name: 'riskInfoLib',
    component: () => import('@/views/RiskInfoLib.vue'),
  },
  // 政策法规
  {
    path: `${prefix}/newsPolicies`,
    name: 'newsPolicies',
    component: () => import('@/views/xxzx/zcfg.vue'),
  },
  // 热点新闻
  {
    path: `${prefix}/newsHotspot`,
    name: 'newsHotspot',
    component: () => import('@/views/xxzx/rdzx.vue'),
  },
  // 行业动态
  {
    path: `${prefix}/newsIndustry`,
    name: 'newsIndustry',
    component: () => import('@/views/xxzx/hyzs.vue'),
  },
  // 资讯维护
  {
    path: `${prefix}/newsInformation`,
    name: 'newsInformation',
    component: () => import('@/views/xxzx/ZixunWeihu.vue'),
  },
  //工单管理
  {
    path: `${prefix}/workOrder`,
    name: 'workOrder',
    component: () => import('@/views/WorkOrder.vue'),
  },

  // 管理侧
  // 首页
  {
    path: `${prefix}/home`,
    name: 'home',
    component: () => import('@/views/home/Home.vue'),
  },
  // 站点维护-门户
  {
    path: `${prefix}/portalList`,
    name: 'portalList',
    component: () => import('@/views/orgMgmt/PortalList.vue'),
  },
  // 站点维护-企业概览
  {
    path: `${prefix}/orgMgmt/overview`,
    name: 'overview',
    component: () => import('@/views/orgMgmt/Overview.vue'),
  },
  //企业名录
  {
    path: `${prefix}/entDirectory`,
    name: 'entDirectory',
    component: () => import('@/views/directory/EntDirectory.vue'),
  },
  //企业名录详情
  {
    path: `${prefix}/entDirectoryDetails`,
    name: 'entDirectoryDetails',
    component: () => import('@/views/directory/EntDirectoryDetails.vue'),
  },
  //合同管理
  {
    path: `${prefix}/contractManagement`,
    name: 'contractManagement',
    component: () => import('@/views/ContractManagement.vue'),
  },
  // 运营报告
  {
    path: `${prefix}/operationRep`,
    name: 'operationRep',
    component: () => import('@/views/OperationRep.vue'),
  },
  // 能源信息维护
  {
    path: `${prefix}/maintain/engType`,
    name: 'mEngType',
    component: () => import('@/views/maintain/EngType.vue'),
  },
  // 计量表类型维护
  {
    path: `${prefix}/maintain/meters`,
    name: 'mMeters',
    component: () => import('@/views/maintain/Meters.vue'),
  },
  // 能源计费方式维护
  {
    path: `${prefix}/maintain/engBill`,
    name: 'mEngBill',
    component: () => import('@/views/maintain/EngBill.vue'),
  },
  // 折标系数维护
  {
    path: `${prefix}/maintain/stdCoalCoeff`,
    name: 'mStdCoalCoeff',
    component: () => import('@/views/maintain/StdCoalCoeff.vue'),
  },
  // 消息列表
  {
    path: `${prefix}/message`,
    name: 'message',
    component: () => import('@/views/Message.vue'),
  },
  // 能耗占比分析
  {
    path: `${prefix}/engProportionAnalysis`,
    name: 'engProportionAnalysis',
    component: () => import('@/views/analysis/EnergyAnalysis.vue'),
  },
  // 费用分析
  {
    path: `${prefix}/costAnalysis`,
    name: 'costAnalysis',
    component: () => import('@/views/analysis/CostAnalysis.vue'),
  },
];
const router = new VueRouter({ routes });

export const useRouter = () => {
  const vm = getCurrentInstance();
  if (!vm) throw new Error('must be called in setup');
  return vm.proxy.$router;
};
export const useRoute = () => {
  const vm = getCurrentInstance();
  if (!vm) throw new Error('must be called in setup');
  return vm.proxy.$route;
};
export default router;
